package com.demo.security.model;

import java.util.HashMap;
import java.util.Map;

public enum UserStatus {

    /**
     * 基础数据启用、停用状态
     */
    DISABLE(0, "停用"),
    ENABLE(1, "启用"),
    NO_DELETED(0, "未删除"),
    DELETED(1, "已删除");

    private static final Map<Integer, UserStatus> map = new HashMap();

    static {
        UserStatus[] values = values();
        int length = values.length;
        for (int i = 0; i < length; i++) {
            UserStatus value1 = values[i];
            map.put(value1.getValue(), value1);
        }
    }

    /**
     * 值
     */
    private final Integer value;
    /**
     * 描述
     */
    private final String desc;

    UserStatus(final Integer value, final String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static UserStatus getEnumByValue(String value) {

        return map.get(value);
    }

    public Integer getValue() {
        return this.value;
    }

    public String getDesc() {
        return this.desc;
    }

    @Override
    public String toString() {
        return this.desc;
    }


}
